﻿@model MasResourceGroup

@if (ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit")
{
    @Html.HiddenFor(model => model.ResGrpId)
}
@{
    int resTypeId = ViewBag.ResTypeId;
    MasResourceType resType =ViewBag.ResType;
}
@Html.Hidden("ResTypeId", resTypeId)
@Html.HiddenFor(model => model.MinPriceCalDepreciation) 
@Html.HiddenFor(model => model.AssetAccountId)
@Html.HiddenFor(model => model.CumdepreAccountId)
@Html.HiddenFor(model => model.DepreAccountId)
@Html.HiddenFor(model => model.BreakAccountId)
@Html.HiddenFor(model => model.ConsumeAccountId)
@Html.HiddenFor(model => model.RecordStatus)
@Html.HiddenFor(model => model.CreatedBy)
@Html.HiddenFor(model => model.CreatedWhen)
@Html.HiddenFor(model => model.UpdatedBy)
@Html.HiddenFor(model => model.UpdatedWhen)

<div class="widget-box">
	<div class="widget-header header-color-blue2">
        <h4 class="lighter smaller">หมวดพัสดุ</h4>
    </div>
	<div class="widget-body">
		<div class="widget-body-inner">
			<div class="widget-main">
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.Code)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.Code)
						@Html.ValidationMessageFor(model => model.Code)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.OldCode)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.OldCode)
						@Html.ValidationMessageFor(model => model.OldCode)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.Name)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.Name)
						@Html.ValidationMessageFor(model => model.Name)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.ResTypeId)
					</div>
					<div class="controls">
						@resType.Code - @resType.Name
						@Html.ValidationMessageFor(model => model.ResTypeId)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.DpTypeId)
					</div>
                    <div class="controls">
                        @{
                            var list = (from d in new KPIS.GERP.WEB.GIMS.MasDepreciationTypeService.MasDepreciationTypeServiceClient().SelectMasDepreciationType(new MasDepreciationType{RecordStatus = "!D"}, null)
                                        select new SelectListItem{Text = d.Name, Value = d.DpTypeId.ToString()}).ToList();
                            list.Insert(0, new SelectListItem {Text = "ไม่เลือก", Value = ""});
                        }
                        @Html.DropDownListFor(model => model.DpTypeId, list, new Dictionary<string, object>{{"class","chzn-select"}, {"data-placeholder", ""}})
                        @Html.ValidationMessageFor(model => model.DpTypeId)
                    </div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.Descr)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.Descr, "TextArea")
						@Html.ValidationMessageFor(model => model.Descr)
					</div>
				</div>
			</div>
		</div>
	</div> 
</div>
